-
Notifications
You must be signed in to change notification settings - Fork 578
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update muted words handling, add attributes #2276
Conversation
0bd0dbc
to
ca359ca
Compare
…cements * origin/main: (181 commits) Minor OAuth client fixes (#2640) Version packages (#2639) OAuth: 2FA (#2633) Version packages (#2622) Update data source for `getSuggestedFollowsByActor` (#2630) Add in-memory did cache to Ozone backend (#2635) Filter out reference lists from `getLists` (#2629) lexicons: add missing ozone Tag event type to unions (#2632) ✨ Add ozone proxy for getLikes and getRepostedBy (#2624) Upgrade pnpm/action-setup in workflows (#2625) ✨ Add proxy for user typeahead through ozone (#2612) Fix development commands (#2623) Add starter packs to post hydration (#2613) Social proof blocks (#2603) Appview: apply hosting status in getRecord (#2620) Add `labelersPref` to `getPreferences` union return types (#2554) Version packages (#2618) Add new preference and api for bsky app state; also put preference updates within transactional lock regions (#2492) remove mentions of sandbox (#2611) Appview: simple fix for no-hosted known followers (#2609) ...
* Check expiry when comparing mute words * Check actors when comparing * Tweak lex, condegen * Integrate new prop
Would you consider merging #2570 in relation to muted words? There is a problem with the current implementation of |
(cherry picked from commit ad31910)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work. Very clean
lexicons/app/bsky/actor/defs.json
Outdated
"actorTarget": { | ||
"type": "string", | ||
"description": "Groups of users to apply the muted word to. If undefined, applies to all users.", | ||
"knownValues": ["all", "exclude-following"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IIRC we have a "default" field that might be useful here to indicate what it does if nothing is specified
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah yeah we do! So interesting thing though: this removes the ?
optionality of the prop actorTarget
. Technically on first read, mute words aren't migrated, so actorTarget
for old mute words will always be undefined.
In my latest commit, I opted to map over existing words and insert that default value if actorTarget
is undefined.
Cool with that? If not, I think the move would be to remove the default to keep the type optional.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Huh. I dont recall why we wouldve done it that way, other than perhaps because we expected the default value to always get filled in.
I'm totally good w/what you did but up to you
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like that it's a little tighter like this so gonna roll with it 👍
…cements * origin/main: Use default Statsig export (#2660) remove link to invite code form (#2655) Version packages (#2652) Priority notification setting (#2648) fix(api): `hasMutedWord` for facets with multiple features (#2570) Appview: enable insight into full thread context (#2651) 🐛 include takedowns in post thread for admins (#2642)
0508d74
to
3c2c06b
Compare
Adds a few new attributes to muted words:
id
a unique identifier for CRUD actionsactors
an array of DIDs that the muted word will apply toexpiresAt
adatetime
string representing the time after which the muted word will no longer applyAll these fields are optional. Because CRUD is now based on the
id
(it was shortsighted on my part not to do this to begin with), the methods have been updated accordingly. Matching is done with preference forid
, with fallback tovalue
for legacy words.With this update, upon any add/update/remove action, all muted words will be checked and migrated if needed. Since this happens on any action, this means that the user only needs to add/update/remove a word once to trigger a full migration and bring their preferences into their latest state.
id
for the wordI added a few tests for these legacy cases, plus reorganized and renamed the other tests for more clarity.